Keyword Reference

With...EndWith

Used to reduce long references to object type variables

With <expression>
    statements
    ...
Endwith

 

Parameters

expression Must be an object type expression

 

Remarks

With...EndWith statements may NOT be nested.

 

Related

For...In...Next

 

Example


$oExcel = ObjCreate("Excel.Application")
$oExcel.visible =1
$oExcel.workbooks.add

With $oExcel.activesheet
    .cells(2,2).value = 1
    .range("A1:B2").clear
Endwith

$oExcel.quit